;function checkForm() {
    var username = $("#username").val();
    var password = $("#password").val();
    if (username == "" || username == null) {
        $("#username").focus();
        $("#span1").css("color", "red");
        $("#span2").html("");
        $("#span1").html("请输入账号");
        return false;
    } else if (password == "" || password == null) {
        $("#password").focus();
        $("#span2").css("color", "red");
        $("#span1").html("");
        $("#span2").html("请输入密码");
        return false;
    } else {
        $("#span1").html("");
        $("#span2").html("");
        $.ajax({
            url: "user/login",
            data: {
                "username": username,
                "password": password
            },
            type: "POST",
            dataType: "json",
            beforeSend: function () {
                $("#loginBtn").attr('disabled', 'disabled');
            },
            success: function (data) {
                if (data.code == true) {
                    // event.preventDefault();
                    $('form').fadeOut(500);
                    $('.wrapper').addClass('form-success');
                    setTimeout(window.location = "user/Index", 1000);
                } else {
                    $("#span2").css("color", "red");
                    $("#span2").html(data.msg);
                    $("#loginBtn").removeAttr('disabled');
                }
            },
            error: function () {
                $("#span2").css("color", "red");
                $("#span2").html("网络繁忙，请稍后再试");
                $("#loginBtn").removeAttr('disabled');
            }
        });
        return false;
    }
}
